package com.xtaller.sdboot.config;

import com.xtaller.sdboot.constant.FileConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author : Taller
 * @date : 2020/2/27 14:50
 * @Description :
 */
@SpringBootConfiguration
public class ImageSourceConfig implements WebMvcConfigurer {
    @Autowired private FileConfig fileConfig;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/resource/images/**")
                .addResourceLocations("file:" + fileConfig.getImages());
    }
}
